/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.musictalk.model.connect;

import com.musictalk.message.model.*;
import com.musictalk.model.business.ManageClientConnThread;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author AIDEN
 */
public class OnlineFriendThread extends Thread {

    private String userID;
//    private ObjectOutputStream oos;

    public OnlineFriendThread(String UID) {
        this.userID = UID;
//        try {
//            oos = new ObjectOutputStream(ManageClientConnThread.getClientConnThread(userID).gettSocket().getOutputStream());
//        } catch (IOException ex) {
//            Logger.getLogger(OnlineFriendThread.class.getName()).log(Level.SEVERE, null, ex);
//        }
    }

    @Override
    public void run() {
        while (true) {
            RequestOnline ronline = new RequestOnline(userID);
            try {
                ObjectOutputStream oos = new ObjectOutputStream(ManageClientConnThread.getClientConnThread(userID).gettSocket().getOutputStream());
                oos.writeObject(ronline);
                Thread.sleep(1000);
            } catch (InterruptedException ex) {
                Logger.getLogger(OnlineFriendThread.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(OnlineFriendThread.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
}
